package a.h;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.Map;

class k
  extends i
{
  k(ec paramec, Map paramMap)
  {
    super(paramec, paramMap, new JTextField(5));
    this.q.a(a());
  }
  
  protected ActionListener a()
  {
    return new a_();
  }
  
  class a_
    implements ActionListener
  {
    a_() {}
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      JFileChooser localJFileChooser = a();
      a(localJFileChooser);
      if (c(localJFileChooser) == 0) {
        try
        {
          File localFile = localJFileChooser.getSelectedFile();
          if (ec.t == 0)
          {
            if (!localFile.exists()) {
              localFile = localFile.getParentFile();
            }
            k.this.a(a(localFile.getCanonicalPath()));
            k.this.d(false);
            k.this.p.requestFocus();
          }
        }
        catch (IOException localIOException)
        {
          n.a("file problem: " + localIOException);
        }
      }
    }
    
    private JFileChooser a()
    {
      Object localObject = k.this.i.c(rc.E);
      if ((ec.t != 0) || ((localObject instanceof JFileChooser))) {
        return (JFileChooser)localObject;
      }
      JFileChooser localJFileChooser = new JFileChooser();
      localJFileChooser.setDialogType(0);
      return localJFileChooser;
    }
    
    String a(String paramString)
    {
      int i = ec.t;
      if (i == 0)
      {
        if (Boolean.TRUE.equals(k.this.k().c("FileOptionItem.prefixFileProtocol"))) {
          if (i != 0) {
            break label77;
          }
        }
      }
      else if (!paramString.startsWith("file://"))
      {
        if (i != 0) {
          break label77;
        }
        if (paramString.trim().length() > 0) {
          return "file://" + paramString;
        }
      }
      label77:
      return paramString;
    }
    
    String c(String paramString)
    {
      int i = ec.t;
      if (i == 0)
      {
        if (Boolean.TRUE.equals(k.this.k().c("FileOptionItem.prefixFileProtocol"))) {
          if (i != 0) {
            break label50;
          }
        }
      }
      else if (paramString.startsWith("file://")) {
        return paramString.substring(7);
      }
      label50:
      return paramString;
    }
    
    private void a(JFileChooser paramJFileChooser)
    {
      String str = c(k.this.p.getText());
      if (str.length() > 0)
      {
        File localFile = new File(str);
        if ((ec.t != 0) || (!localFile.isDirectory())) {
          localFile = localFile.getParentFile();
        }
        paramJFileChooser.setCurrentDirectory(localFile);
      }
    }
    
    private int c(JFileChooser paramJFileChooser)
    {
      JComponent localJComponent = k.this.f();
      if (ec.t == 0) {
        switch (paramJFileChooser.getDialogType())
        {
        case 0: 
          return paramJFileChooser.showOpenDialog(localJComponent);
        case 1: 
          return paramJFileChooser.showSaveDialog(localJComponent);
        case 2: 
          return paramJFileChooser.showDialog(localJComponent, paramJFileChooser.getApproveButtonText());
        }
      }
      return paramJFileChooser.showOpenDialog(localJComponent);
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.h.k

 * JD-Core Version:    0.7.0.1

 */